package com.lemonsama.lesson5;

import javax.swing.*;
import java.awt.*;
import java.net.URL;

    public class JButtonTest extends JFrame {

    public JButtonTest() {
        Container contentPane = this.getContentPane();
        URL resource = JButtonTest.class.getResource("1640404870375.png");
        Icon Icon = new ImageIcon(resource);

        JButton button = new JButton();
        button.setIcon(Icon);
        button.setToolTipText("图片按钮");
        contentPane.add(button);
        this.setSize(500, 300);
        this.setVisible(true);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        new JButtonTest();
    }
}
